package com.bawei.live.model

import com.bawei.common.entity.SimpleVideoEntity
import com.bawei.live.api.LiveServerApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

/**
 * @Author: Lin Liu
 * @CreateTime: 2025年02月17日 15:58:23
 * @Description:
 */
class LiveRepository @Inject constructor(private val apiServer: LiveServerApi){

    suspend fun getRecommendVideo(page: Int, pageSize: Int): Flow<List<SimpleVideoEntity>> {
        return flow {
            var result = apiServer.getRecommendSimpleVideo(page, pageSize)
            if (result.code == 0){
                emit(result.data)
            }else{
                emit(listOf())
            }
        }
    }

}